package cn.fancy.sdk.pay.weixin;

import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import cn.fancy.sdk.common.utils.ResUtil;
import cn.fancy.sdk.pay.GuildPayActivity;
import cn.fancy.sdk.pay.view.PayDetailView;

/**
 * Created by zhaojh on date 3/14/21
 */
public class MiniProgramPayView extends PayDetailView implements OnClickListener {
    
    private GuildPayActivity payactivity;
    
    private static final String TAG = MiniProgramPayView.class.getSimpleName();
    
    public MiniProgramPayView(GuildPayActivity activity, int id) {
        super(activity, id);
        this.payactivity = activity;
    }
    
    @Override
    public void onClick(View v) {
        long time = System.currentTimeMillis();
        if (time - lasttime < 1500) {
            return;
        } else {
            lasttime = time;
        }
        
        int vid = v.getId();
        
        if (vid == ResUtil.getId(activity, "guild_paydetail_confirm")) {
            Log.e(TAG, "click");
            
            //todo map req
            // https://developers.weixin.qq.com/doc/oplatform/Mobile_App/Launching_a_Mini_Program/Android_Development_example.html
            // https://developers.weixin.qq.com/doc/oplatform/Mobile_App/Access_Guide/Android.html
            
        }else if (vid == ResUtil.getId(activity, "guild_pay_chargemoney")) {
            // 选择充值金额
            selectAmount();
        }
    }
    
    private long lasttime = 0;
    
    @Override
    public void activityCreated() {
        detailConfirmBt.setOnClickListener(this);
        
    }
}
